<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>调试Bean名称</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
</head>
<body>
    <div class="container-fluid mt-4">
        <h2>调试Bean名称</h2>
        
        <div class="card mb-4">
            <div class="card-header">
                <h5>Bean名称测试</h5>
            </div>
            <div class="card-body">
                <form id="beanTestForm">
                    <div class="form-group">
                        <label for="className">实体类全名</label>
                        <input type="text" class="form-control" id="className" name="className" value="com.vegetable.modules.entity.baseData.Products">
                    </div>
                    <button type="button" class="btn btn-primary" onclick="testBeanName()">测试Bean名称</button>
                </form>
            </div>
        </div>
        
        <div class="card">
            <div class="card-header">
                <h5>测试结果</h5>
            </div>
            <div class="card-body">
                <pre id="result" style="background-color: #f8f9fa; padding: 15px; border-radius: 5px; max-height: 500px; overflow-y: auto;">
// 点击按钮查看结果
                </pre>
            </div>
        </div>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
    <script>
        // 测试Bean名称
        function testBeanName() {
            const className = $('#className').val();
            
            // 在实际应用中，这部分逻辑应该在后端实现
            // 这里只是模拟前端的计算过程
            try {
                const simpleName = className.substring(className.lastIndexOf('.') + 1);
                const firstLetter = simpleName.substring(0, 1).toLowerCase();
                const serviceName = firstLetter + simpleName.substring(1) + "ServiceImpl";
                const alternativeName = simpleName + "Service";
                
                const result = {
                    className: className,
                    simpleName: simpleName,
                    serviceName: serviceName,
                    alternativeName: alternativeName,
                    message: "根据实体类名计算出的Bean名称"
                };
                
                $('#result').text(JSON.stringify(result, null, 2));
            } catch (e) {
                $('#result').text('处理出错: ' + e.message);
            }
        }
        
        // 页面加载完成后测试一次
        $(document).ready(function() {
            testBeanName();
        });
    </script>
</body>
</html>